<?php
namespace app\api\model;
use think\Model;

class Transfer extends Model{  
    protected $type = [
        'id'    =>  'integer',
        'from_bank'    =>  'integer',
        'to_bank'    =>  'integer',
        'is_from_review'    =>  'integer',
        'is_to_review'    =>  'integer'         
    ];

    public function transferList($filter = null){
        $where = [];
        $page = 1;
        $pageCount = 10;       
        if(!empty($filter)){  
            //页码            
            $page = !empty($filter['page']) ? $filter['page'] : $page;
            $pageCount = !empty($filter['page_count']) ? $filter['page_count'] : $pageCount;
        }
        $datas = $this->where($where)->page("$page,$pageCount")->order('id', 'desc')->select();
        $dataCount =  $this->where($where)->count();       
        $datalist = array(
            'datas' => $datas,           
            'dataCount' => $dataCount
        );
        return $datalist;
    }
}